package com.example.demo.command2;

import java.util.HashMap;
import java.util.Map;

/**
 * 上帝
 */
public class Customer {
    public static void main(String[] args) {
        // 哪个厨师
        Chef chef = new Chef();
        // 一对情侣的点餐
        // 菜品和份量
        Map<String, Integer> firstOrderMap = new HashMap<>(8);
        firstOrderMap.put("牛扒",2);
        firstOrderMap.put("蛤蜊汤",2);
        firstOrderMap.put("意面",1);

        Order firstOrder = new Order();
        firstOrder.setDinningTable(2);
        firstOrder.setOrderMap(firstOrderMap);
        // 遥控后厨的遥控器
        OrderCommand firstOrderCommand = new OrderCommand(chef, firstOrder);

        // 单身狗的点餐
        Map<String, Integer> secondOrderMap = new HashMap<>(8);
        secondOrderMap.put("牛腩粉",2);

        Order secondOrder = new Order();
        secondOrder.setDinningTable(2);
        secondOrder.setOrderMap(secondOrderMap);
        // 遥控后厨的遥控器
        OrderCommand secondOrderCommand = new OrderCommand(chef, secondOrder);

        BeautyWaiter beautyWaiter = new BeautyWaiter();
        beautyWaiter.addCommand(firstOrderCommand);
        beautyWaiter.addCommand(secondOrderCommand);
        // 通知后厨干活
        beautyWaiter.pushOrder();

        System.out.println("源码中命令模式的使用");
        MyThread myThread = new MyThread();
        myThread.run();
    }

}
